[IA64] Fix LOAD_PHYSICAL for INIT handler
authorAlex Williamson <alex.williamson@hp.com>
Tue, 11 Dec 2007 17:14:11 +0000 (10:14 -0700)
committerAlex Williamson <alex.williamson@hp.com>
Tue, 11 Dec 2007 17:14:11 +0000 (10:14 -0700)
Xen virtual address space moves to 0xf400000004000000.
So LOAD_PHYSICAL is broken. I fixed LOAD_PHYSICAL with ia64 patch.
This patch also fixes INIT handler.

Signed-off-by: Akio Takebe <takebe_akio@jp.fujitsu.com>
xen/arch/ia64/linux-xen/setup.c
xen/arch/ia64/xen/xenpatch.c
xen/include/asm-ia64/linux-xen/asm/asmmacro.h

index 710b6e4b6910356b70f3df4584ab832ede6b5b81..6a0964534c0cd5a4b772c60743816039d8d8df28 100644 (file)
@@ -500,9 +500,7 @@ setup_arch (char **cmdline_p)
 {
        unw_init();
 
-#ifndef XEN
        ia64_patch_vtop((u64) __start___vtop_patchlist, (u64) __end___vtop_patchlist);
-#endif
 
        *cmdline_p = __va(ia64_boot_param->command_line);
 #ifndef XEN
index 3719137160ab91e4f716cd79fd7f033b16363ccf..f9c9f9cafc7f96f571d4a515b97d38da492431f0 100644 (file)
@@ -106,6 +106,30 @@ static void __init xen_patch_frametable_miss(u64 offset)
 #endif
 }
 
+/*
+ * We need sometimes to load the physical address of a kernel
+ * object.  Often we can convert the virtual address to physical
+ * at execution time, but sometimes (either for performance reasons
+ * or during error recovery) we cannot to this.  Patch the marked
+ * bundles to load the physical address.
+ */
+void __init
+ia64_patch_vtop (unsigned long start, unsigned long end)
+{
+       s32 *offp = (s32 *)start;
+       u64 ip;
+
+       while (offp < (s32 *)end) {
+               ip = (u64)offp + *offp;
+
+               /* replace virtual address with corresponding physical address */
+               ia64_patch_imm64(ip, ia64_tpa(get_imm64(ip)));
+               ia64_fc((void *)ip);
+               ++offp;
+       }
+       ia64_sync_i();
+       ia64_srlz_i();
+}
 
 void __init xen_patch_kernel(void)
 {
index 4549cc863754c7e85c2e225a6c91daa825187ba9..73c51e2bc4076f0ee41101f3ff1496f351a3d677 100644 (file)
@@ -59,17 +59,9 @@ name:
        .section ".data.patch.vtop", "a"        // declare section & section attributes
        .previous
 
-#ifdef XEN
-#define        LOAD_PHYSICAL(pr, reg, obj)             \
-[1:](pr)movl reg = obj;;                       \
-       shl reg = reg,4;;                       \
-       shr.u reg = reg,4;;                     \
-       .xdata4 ".data.patch.vtop", 1b-.
-#else
 #define        LOAD_PHYSICAL(pr, reg, obj)             \
 [1:](pr)movl reg = obj;                                \
        .xdata4 ".data.patch.vtop", 1b-.
-#endif
 
 /*
  * For now, we always put in the McKinley E9 workaround.  On CPUs that don't need it,